package com.elibrary;

import android.app.Activity;
import android.content.pm.ActivityInfo;
import android.content.res.Configuration;
import android.os.Bundle;
import android.view.View;
import android.view.Window;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
import nimo.elibrary.actions.User;

/**
 * Created with IntelliJ IDEA.
 * User: Enkuso
 * Date: 11/29/12
 * Time: 4:45 PM
 * To change this template use File | Settings | File Templates.
 */
public class ResetPassword extends Activity {
    @Override
    protected void onCreate(Bundle savedInstanceState) {

        super.onCreate(savedInstanceState);
        //requestWindowFeature(Window.FEATURE_NO_TITLE);
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
        setContentView(R.layout.forgot_password);

    }

    @Override
    public void onConfigurationChanged(Configuration newConfig) {
        super.onConfigurationChanged(newConfig);
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
    }


    public void ResetPassword(View btn)
    {
        EditText email = (EditText) findViewById(R.id.etEmailAddress);
        TextView tvError = (TextView) findViewById(R.id.tvError);

        boolean resetPwdResult = User.ResetPassword(email.getText().toString());
        if(resetPwdResult){
            Toast.makeText(this, R.string.reset_password_success, Toast.LENGTH_SHORT).show();
            finish();
        } else {
            tvError.setText(R.string.reset_password_error);
        }
    }
}
